//
//  OnlineMovieModel.m
//  UI_18 HomeWork  讲解 豆瓣网络请求 StoryBoard
//
//  Created by dllo on 16/1/29.
//  Copyright © 2016年 wyl. All rights reserved.
//

#import "OnlineMovieModel.h"

#import "MovieDetailModel.h"

@implementation OnlineMovieModel

- (instancetype)initWithDataSource:(NSDictionary *)dataSource {
    
    self = [super init];
    
    if (self) {
//      通过KVC给自己赋值
    [self setValuesForKeysWithDictionary:dataSource];
//      定义存储的可变数组
    NSMutableArray *mutableArray = [NSMutableArray arrayWithCapacity:0];
        
        for (NSDictionary *dic in self.entries) {
            MovieDetailModel *movieDatailModel = [[MovieDetailModel alloc] init];
            [movieDatailModel setValuesForKeysWithDictionary:dic];
            [mutableArray addObject:movieDatailModel];
        }
    self.entries = [NSArray arrayWithArray:mutableArray];
        
    }
    return self;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    
}

- (id)valueForUndefinedKey:(NSString *)key {
    return nil;
}

@end
